
  <div class="x_panel">
    <div class="x_content" style="display: block;">
      <div class="nav navbar-left panel_toolbox">
        <form name="form" action="" method="post">
        <input type="text"  name="form[start_time]" value="{if isset($start_time)}{$start_time}{/if}" placeholder="时间" id="J_dh_start" class="form-control-new" >
        <select class="form-control-area" name="form[shop_id]">
          {if isset($selshop)}
          <option value="{$selshop.shop_id}">{$selshop.shop_name}</option>
          <option value="0">全部</option>
          {else}
          <option value="0">全部</option>
          {/if}
          {foreach $shop AS $key => $value}
          <option value="{$value.shop_id}">{$value.shop_name}</option>
          {/foreach}
        </select>
        <select class="form-control-area" name="form[province_id]" id="zone1">
          {if isset($selprovince)}
          <option value="{$selprovince.region_code}">{$selprovince.region_name}</option>
          <option value="0">全部</option>
          {else}
          <option value="0">全部</option>
          {/if}
          {foreach $province AS $key => $value}
          <option value="{$value.region_code}">{$value.region_name}</option>
          {/foreach}
        </select>
        <label class="control-label w50">省</label>

        <select class="form-control-area" name="form[city_id]" id="zone2">
          {if isset($selcity)}
          <option value="{$selcity.region_code}">{$selcity.region_name}</option>
          <option value="0">全部</option>
          {else}
          <option value="0">全部</option>
          {/if}
          {if isset($city)}
          {foreach $city AS $key => $value}
          <option value="{$value.region_code}">{$value.region_name}</option>
          {/foreach}
          {/if}
        </select>
        <label class="control-label w50">市</label>

        <select class="form-control-area" name="form[district_id]" id="zone3">
          {if isset($seldistrict)}
          <option value="{$seldistrict.region_code}">{$seldistrict.region_name}</option>
          <option value="0">全部</option>
          {else}
          <option value="0">全部</option>
          {/if}
          {if isset($district)}
          {foreach $district AS $key => $value}
          <option value="{$value.region_code}">{$value.region_name}</option>
          {/foreach}
          {/if}
        </select>
        <label class="control-label w50">区</label>

        <select class="form-control-area" name="form[street_id]" id="zone4">
          {if isset($selstreet)}
          <option value="{$selstreet.region_code}">{$selstreet.region_name}</option>
          <option value="0">全部</option>
          {else}
          <option value="0">全部</option>
          {/if}
          {if isset($street)}
          {foreach $street AS $key => $value}
          <option value="{$value.region_code}">{$value.region_name}</option>
          {/foreach}
          {/if}
        </select>
        <label class="control-label w50">街道</label>
          <input class="btn btn-primary" type="submit" name="submit" value="搜索" onClick="javascript:form.action='index.html';">
          <input class="btn btn-primary" type="submit" name="submit" value="导出" onClick="javascript:form.action='index.html';">
        <!--<button class="btn btn-primary" type="submit">搜索</button><button class="btn btn-primary" type="submit">导出</button>-->
        </form>
      </div>
      <br><br>
      <div class="cont">
        <table class="table table-bordered table-striped">
          <thead>
          <tr>
            <th width="100px">序号</th>
            <th>区域</th>
            <th>商家名称</th>
            <th>账号</th>
            <th>角色</th>
            <th>入场券订单分佣</th>
            <th>会员卡订单分佣</th>
            <th>商品订单出售分佣</th>
            <th>商品订单回收分佣</th>
            <th>摇摇车分佣</th>
            <th>分佣总和</th>
          </tr>
          </thead>
          <tbody id="result">
          {foreach $commission as $key=>$commissionitem}
          <tr>
            <td>{$key+1}</td>
            <td>{$commissionitem.province}{$commissionitem.city}{$commissionitem.district}{$commissionitem.street}</td>
            <td>{$commissionitem.shop_name}</td>
            <td>{$commissionitem.phone}</td>
            <td>{if $commissionitem.type==1}店主{else}店长{/if}</td>
            <td>{if isset($commissionitem.quan)}{$commissionitem.quan}元{else}0元{/if}</td>
            <td>{if isset($commissionitem.card)}{$commissionitem.card}元{else}0元{/if}</td>
            <td>{if isset($commissionitem.sale_goods)}{$commissionitem.sale_goods}元{else}0元{/if}</td>
            <td>{if isset($commissionitem.recovery_goods)}{$commissionitem.recovery_goods}元{else}0元{/if}</td>
            <td>{if isset($commissionitem.yoyo)}{$commissionitem.yoyo}元{else}0元{/if}</td>
            <td>{if ($commissionitem.total>0)}{$commissionitem.total}元{else}0元{/if}</td>
          </tr>
          {/foreach}
          </tbody>
        </table>
      </div>
    </div>
  </div>

  <script type="text/javascript" src="{$theme}/libs/js/datepicker/bootstrap-datetimepicker.min.js"></script>
  <script>
      var startDate = $('#J_dh_start').datetimepicker({
          format: "yyyy-MM",
          autoclose: true,
          todayBtn: true,
          minView: 2,
      })/*.on('changeDate', function(ev) {
          //var evDate = ev.date.getFullYear() + '-' + (ev.date.getMonth() + 1) + '-' + ev.date.getDate();
          //$('#J_dh_end').datetimepicker('setStartDate', evDate);
          start_time = $(this).val();
          var url = "{['commission/index']|U}";
          $.post(url, 'start_time='+start_time, function (data) {
              $('#result').html('');
              $.each(data, function(i,val){
                  key = i+1;
                  html = "<tr>";
                  html += "<td>"+key+"</td>";
                  html += "<td>"+val.shop_name+"</td>";
                  html += "<td>"+val.phone+"</td>";
                  if(val.type==1){
                      html += "<td>店主</td>";
                  }else{
                      html += "<td>店长</td>";
                  }
                  if(val.quan){
                      html += "<td>"+val.quan+"元</td>";
                  }else{
                      html += "<td>0元</td>";
                  }
                  if(val.card){
                      html += "<td>"+val.card+"元</td>";
                  }else{
                      html += "<td>0元</td>";
                  }
                  if(val.sale_goods){
                      html += "<td>"+val.sale_goods+"元</td>";
                  }else{
                      html += "<td>0元</td>";
                  }
                  if(val.recovery_goods){
                      html += "<td>"+val.recovery_goods+"元</td>";
                  }else{
                      html += "<td>0元</td>";
                  }

                  html += "</tr>";
                  $('#result').append(html)
              });
          },'json');

      });*/


      $('#zone1').change(function (e) {
          var zoneid = this.value;
          var url = "{['area/getzone']|U}";
          $.post(url, 'zoneid='+zoneid, function (data) {
              $('#zone2').html('');
              for(var i=0; i<data.length; i++){
                  $('#zone2').append("<option value= '"+data[i].region_code+"'>"+data[i].region_name+"</option>");
              }
              $.post(url, 'zoneid='+data[0].region_code, function (data1) {
                  $('#zone3').html('');
                  for(var i=0; i<data1.length; i++){
                      $('#zone3').append("<option value= '"+data1[i].region_code+"'>"+data1[i].region_name+"</option>");
                  }
                  $.post(url, 'zoneid='+data1[0].region_code, function (data2) {
                      $('#zone4').html('');
                      for(var i=0; i<data2.length; i++){
                          $('#zone4').append("<option value= '"+data2[i].region_code+"'>"+data2[i].region_name+"</option>");
                      }
                      $('#street_id').val(data2[0].region_code);
                      $('#remark').val(data2[0].remark);
                  },'json');
              },'json');

          },'json');
      })
      $('#zone2').change(function (e) {
          var zoneid = this.value;
          var url = "{['area/getzone']|U}";
          $.post(url, 'zoneid='+zoneid, function (data) {
              $('#zone3').html('');
              for(var i=0; i<data.length; i++){
                  $('#zone3').append("<option value= '"+data[i].region_code+"'>"+data[i].region_name+"</option>");
              }
              $.post(url, 'zoneid='+data[0].region_code, function (data1) {
                  $('#zone4').html('');
                  for(var i=0; i<data1.length; i++){
                      $('#zone4').append("<option value= '"+data1[i].region_code+"'>"+data1[i].region_name+"</option>");
                  }
                  $('#street_id').val(data1[0].region_code);
                  $('#remark').val(data1[0].remark);
              },'json');
          },'json');
      })
      $('#zone3').change(function (e) {
          var zoneid = this.value;
          var url = "{['area/getzone']|U}";
          $.post(url, 'zoneid='+zoneid, function (data) {
              $('#zone4').html('');
              for(var i=0; i<data.length; i++){
                  $('#zone4').append("<option value= '"+data[i].region_code+"'>"+data[i].region_name+"</option>");
              }
              $('#street_id').val(data[0].region_code);
              $('#remark').val(data[0].remark);
          },'json');
      })
  </script>

